package niuke;

import java.util.Arrays;
import java.util.Scanner;

public class n个数中出现次数大于一半的数 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String strs[] = str.split(" ");
        String result="";
        int[] a = new int[strs.length-1];
        for(int i=0;i<strs.length-1;i++){
            a[i] = Integer.parseInt(strs[i]);
        }
        int k = Integer.parseInt(strs[strs.length-1]);
        Arrays.sort(a);
        for(int i=0;i<k;i++){
            result = result + a[i] + " ";
        }
        System.out.println(result.substring(0,result.length()-1));
    }
}
